package com.doctcloud.hisinfo.histable.domain.comm;

import com.baomidou.mybatisplus.annotation.TableName;
import com.doctcloud.common.core.annotation.Excel;
import com.doctcloud.common.core.annotation.TableDesc;
import com.doctcloud.common.core.web.domain.BaseCharsetEntity;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

import static com.doctcloud.common.core.utils.StringUtils.trim;

@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(of = {"signCode"})
@ToString
@Data
@TableDesc("药品标签字典")
//public class DrugSignDictDo extends BaseCharsetEntity {
public class DrugSignDictDo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Excel(name = "标签代码")
    @NotBlank(message = "标签代码不得为空")
    private String signCode;
    @Excel(name = "标签描述")
    @NotBlank(message = "标签描述不得为空")
    private String signDesc;
    @Excel(name = "所属标签类型")
    @NotBlank(message = "所属标签类型不得为空")
    private String signClass;
    @Excel(name = "在用标记" , readConverterExp = "0=停用,1=在用")
    @NotNull(message = "在用标记不得为空")
    private Integer useInd;
    @Data
    public static class primaryKey {
        private final String signCode;
        public primaryKey(String signCode) {
            this.signCode = signCode;
        }
    }
    public void setSignCode(String signCode) {
        this.signCode = trim(signCode);
    }

    public void setSignDesc(String signDesc) {
        this.signDesc = trim(signDesc);
    }

    public void setSignClass(String signClass) {
        this.signClass = trim(signClass);
    }
    public void setUseInd(Integer useInd) {
        this.useInd = useInd == null ? 1:useInd;
    }
}
